angular.module('moti.services.loginService', ['restangular', 'moti.directive.modal'])
    .factory('LoginInterface', ['Restangular', function(Restangular){
        var login = Restangular.all('admin');
        return function(request_body){
            return login.customPOST(request_body, INTERFACE_API.LOGIN);
        }
    }])
    .run(['Restangular', '$modal', function(Restangular, $modal){
        //设置基本路径
        Restangular.setBaseUrl(DOMAIN_PATH);
        //设置错误拦截器
        Restangular.setErrorInterceptor(function(resp){
            $modal({id : 'tip-modal', text : "用户名或密码错误，请重新登录"}).show().autoHide();
            return false;
        });
    }]);